#ifndef BITSET_H
#define BITSET_H

#include <cstdint>

class BitSet {
  public:
    virtual int length() = 0;

    virtual void set( int index, bool value ) = 0;

    virtual bool get( int index ) = 0;

    virtual void print() = 0;

    class IndexOut{
      public:
        IndexOut( int index, int limit ) :
          index( index ), limit( limit ) {}

      private:
        int index;
        int limit;
    };

    static uint64_t masks[ 64 ];
};

class BitSet8 : public BitSet {
  public:
    BitSet8();

    virtual int length();

    virtual void set( int index, bool value );

    virtual bool get( int index );

    virtual void print();

  private:
    uint8_t array;
};

class BitSet16 : public BitSet {
  public:
    BitSet16();

    virtual int length();

    virtual void set( int index, bool value );

    virtual bool get( int index );

    virtual void print();

  private:
    uint16_t array;
};

class BitSet32 : public BitSet {
  public:
    BitSet32();

    virtual int length();

    virtual void set( int index, bool value );

    virtual bool get( int index );

    virtual void print();

  private:
    uint32_t array;
};

class BitSet64 : public BitSet {
  public:
    BitSet64();

    virtual int length();

    virtual void set( int index, bool value );

    virtual bool get( int index );

    virtual void print();

  private:
    uint64_t array;
};

#endif /* BITSET_H */
